package com.go.where.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.manager.dao.CustomerAddressDao;
import com.go.where.manager.page.Pagination;
import com.go.where.manager.pojo.CustomerAddressInfo;
import com.go.where.manager.service.CustomerAddressService;

@Service("customerAddressService")
public class CustomerAddressServiceImpl implements CustomerAddressService {

	@Resource(name = "customerAddressDao")
	private CustomerAddressDao customerAddressDao;

	@Override
	public CustomerAddressInfo queryByPrimartKey(String cid) {
		return customerAddressDao.getByKey(cid);
	}

	@Override
	public Pagination<CustomerAddressInfo> queryPage(
			CustomerAddressInfo customerInfo) {
		Integer count = customerAddressDao.totalCount(customerInfo);
		customerInfo.calculate();
		List<CustomerAddressInfo> list = customerAddressDao
				.queryList(customerInfo);
		Pagination<CustomerAddressInfo> page = customerAddressDao
				.queryPagination(count, list, customerInfo);
		return page;
	}

}
